<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" import="java.net.URLEncoder"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<link href="<c:url value='/css/draw.css'/>" rel="stylesheet">
<link href="<c:url value='/css/easyui.css'/>" rel="stylesheet">
<link href="<c:url value='/css/icon.css'/>" rel="stylesheet">
<script src="<c:url value='/js/jquery.min.js'/>"></script>
<script type="text/javascript"
	src="<c:url value='/js/jquery.easyui.min.js'/>"></script>
<div class="page-header">
	<h3 style="margin-top: auto">数据实体详细信息</h3>
</div>
<div class="row-fluid">
	<div>
		<table class="table table-hover" style="width: 90%">
			<thead>
				<tr>
					<th style="width: 15%">属性</th>
					<th style="width: 85%">详细信息</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>名称</td>
					<td><c:out value="${item.name}" /></td>
				</tr>
				<tr>
					<td>中文名称</td>
					<td><c:out value="${item.cnName}" /></td>
				</tr>
				<tr>
					<td>描述信息</td>
					<td><c:out value="${item.description}" /></td>
				</tr>
				<tr>
					<td>属性</td>
					<td><c:choose>
							<c:when test="${!empty item.attributes}">
								<c:forEach items="${item.attributes}" var="attribute"
									varStatus="s">
									<c:out value="${attribute.type.name}  ${attribute.name}" />
									<br />
								</c:forEach>
							</c:when>
						</c:choose></td>
				</tr>
				<tr>
					<td>函数</td>
					<td><c:choose>
							<c:when test="${!empty item.opertions}">
								<c:forEach items="${item.opertions}" var="opertion"
									varStatus="s">
									<c:set var="newline" value="<%= \"\n\" %>" />
									<c:set var="comment_left" value="/*" />
									<c:set var="comment_right" value="*/" />
									<c:set var="function" value="${comment_left}${opertion.interfaceMethod.description}${comment_right}${newline}${opertion.interfaceMethod.methodSigniture}" />
									<%-- <textarea class="input-xxlarge" readonly="true"><c:out value="${function}" /></textarea> --%>
									<c:out value="${function}"/>
									<br />
								</c:forEach>
							</c:when>
						</c:choose></td>
				</tr>
				<tr>
					<td>类型</td>
					<td><c:out value="${item.type}" /></td>
				</tr>
				<tr>
					<td>操作</td>
					<td><div class="btn-group">
							<button class="btn"
								onclick="window.location.href='<%=request.getContextPath()%>/${item.uri.replace(':','/')}/diagram';"><i class="icon-edit"></i>&nbsp;创建类图</button>
							<button class="btn" onclick="javascript:$('#myModal').dialog('open')"><i class="icon-trash"></i>&nbsp;删除</button>
							<button class="btn" onclick="window.location.href='<%=request.getContextPath()%>/${item.uri.replace(':','/')}/download';"><i class="icon-download"></i>&nbsp;下载代码</button>
							<button class="btn" onclick="window.location.href='<%=request.getContextPath()%>/${item.uri.replace(':','/')}/download/xmi';"><i class="icon-download"></i>&nbsp;下载XMI</button>
						</div></td>
				</tr>
				<tr>
					<td>聚合项</td>
					<td><c:choose>
							<c:when test="${!empty item.aggregations}">
								<c:forEach items="${item.aggregations}" var="list" varStatus="s">
									<c:out value="${list.name}" />
									<br />
								</c:forEach>
							</c:when>
						</c:choose></td>
				</tr>
				<tr>
					<td>继承项</td>
					<td><c:choose>
							<c:when test="${!empty item.extendsSet}">
								<c:forEach items="${item.extendsSet}" var="list" varStatus="s">
									<c:out value="${list.name}" />
									<br />
								</c:forEach>
							</c:when>
						</c:choose></td>
				</tr>
				<tr>
					<td>依赖项</td>
					<td><c:choose>
							<c:when test="${!empty item.depends}">
								<c:forEach items="${item.depends}" var="list" varStatus="s">
									<c:out value="${list.name}" />
									<br />
								</c:forEach>
							</c:when>
						</c:choose></td>
				</tr>
				<c:choose>
					<c:when test="${!empty item.diagram}">
						<tr>
							<td colspan="2">
								<p>类图</p> <iframe name="umldiagram" class="mainIframe"
									frameborder="0" marginwidth="0" marginheight="0" vspace="-170"
									hspace="0" scrolling="auto"
									src="<%=request.getContextPath()%>/${item.diagram.uri.replace(':','/')}?entityName=${item.name}"></iframe>
							</td>
						</tr>
					</c:when>
				</c:choose>
			</tbody>
			<tfoot>
			</tfoot>
		</table>

	</div>
</div>
<!--/row-->
<div id="myModal" class="easyui-dialog" title="删除数据实体"
							style="width: 400px; height: auto; padding: 10px" closed="true"
							data-options="iconCls: 'icon-remove-dialog'" buttons="#dlg-buttons">
							<div>
								<p>确定删除该数据实体吗？</p>
							</div>
						</div>
						<div id="dlg-buttons" style="float: right;">
							<a href="<%=request.getContextPath()%>/${item.uri.replace(':','/')}/delete" class="easyui-linkbutton"
								iconCls="icon-ok-dialog" onclick="dlgOK()">确定</a> <a
								href="javascript:void(0)"
								class="easyui-linkbutton" iconCls="icon-cancel-dialog"
								onclick="dlgCancel()">取消</a>
						</div> <script type="text/javascript">
			$(function() {
				$('#myModal').dialog('close');
			});
			function dlgOK(){
				$('#myModal').dialog('close');
			}
			function dlgCancel(){
				$('#myModal').dialog('close');
			}
	</script>